import React  from 'react'
import './index.css'
export default function Footer({todos, deleteDone,checkAll}) {
  let total = todos.length
  let doneNum = todos.reduce((pre,cur) => pre + cur.isDone, 0)
    return (
        <div className="todo-footer">
        <label>
          <input type="checkbox" onChange={(e )=>checkAll(e.target.checked)} checked={doneNum === total && total > 0} />
        </label>
        <span>
          <span>已完成0</span> / 全部3
        </span>

        <button className="btn btn-danger" onClick={()=> deleteDone()} >清除已完成任务</button>
      </div>
    )

}
